更改 vue-router 的导入写法,以便适应 vue-router 在未来 v5 版本内,更改文件导出格式所带来的破坏性变更 #5824
+1
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
问题背景:为什么要更改?
vue-router 明确在未来的 v5 版本内不会提供
dist/vue-router.esm-bundler.js
导出文件vue-router.esm-bundler.js
not exported in[email protected]
version vuejs/router#2569 (comment)为什么选择在 vue-router v5 版本还没有发版的时候就提前适配?
在特定的
[email protected]
版本内,就会出现构建故障。不更改会带来什么问题?
uniapp H5 项目在
[email protected]
版本下是失败的4.6.0
分支: https://github.com/ruan-cat/bug-in-vue-router-4.6.0-with-uniapp/tree/4.6.0如下图所示,在依赖关系指定为
[email protected]
时,是失败的。uniapp H5 项目在
[email protected]
版本下是成功的4.5.1
分支: https://stackblitz.com/~/github.com/ruan-cat/bug-in-vue-router-4.6.0-with-uniapp?file=package.json如下图所示,在依赖关系指定为
[email protected]
时,是成功的。uniapp H5 项目在
[email protected]
版本下是成功的4.6.3
分支: https://github.com/ruan-cat/bug-in-vue-router-4.6.0-with-uniapp/tree/4.6.3如下图所示,在依赖关系指定为
[email protected]
时,是成功的。有什么故障先例?
fix(vite-plugin-uni): 修复 pinia v3 版本 访问 dist 报错的bug
模仿 pinia v3 版本的更改先例,提前更改 vue-router v5 版本的导入写法
预期被修改的文件